<div class="primary">
   <div class="wrap">
      <div class="highlights">
         <div class="home_slide">
            <ul class="bjqs">
            <?php
            $home_slide = $general->slides(1);
            foreach($home_slide as $slide) {
               ?>
               <li><a href="<?=$slide['sli_link']?>"><img src="<?=$slide['sli_image']?>" alt="<?=$slide['sli_name']?>" /></a></li>
               <?
            }
            ?>
            </ul>
         </div>
         <script class="secret-source">
         jQuery(document).ready(function($) {
            var windowWidth = $(window).width();
            var slidehomewidth;
            var slidehomeheight;
            if(windowWidth >= 980) {
               slidehomewidth = 800;
               slidehomeheight = 328;
            }else if(windowWidth > 767 && windowWidth < 980) {
               slidehomewidth = 760;
               slidehomeheight = 320;
            }else {
               slidehomewidth = windowWidth - windowWidth*0.01;
               slidehomeheight = (328/800)*slidehomewidth;
            }
            $('.home_slide').bjqs({
               height      : slidehomeheight,
               width       : slidehomewidth,
               nexttext : ' ', // Text for 'next' button (can use HTML)
               prevtext : ' ', // Text for 'previous' button (can use HTML)
               responsive  : true
            });
         });
         </script>
         <div class="video_slide">
            <div id="wrap_slv">
            <?php
            $video_slide = $general->slides(2);
            ?>
               <div id="slides_videos">
               <?php
               foreach($video_slide as $slide) {
                  ?>
                  <div class="slide">
                     <a href="<?=$slide['sli_link']?>" target="_blank">
                        <img class="vimg" src="<?=$slide['sli_image']?>" alt="<?=$slide['sli_name']?>" />
                     </a>
                  </div>
                  <?
               }
               ?>
               </div>
               <div id="menu">
                  <ul>
                  <?php
                  foreach($video_slide as $slide) {
                     ?>
                     <li class="menuItem"><a href=""><img src="<?=$slide['sli_image']?>" alt="thumbnail <?=$slide['sli_name']?>" /></a></li>
                     <?
                  }
                  ?>
                  </ul>
               </div>
            </div>
         </div>
      </div>
      <div class="wrap_primary">
         <div class="home_content">
            <div class="home_nav">
               <ul>
                  <li class="nav_phone">
                     <a href="<?=url_phone_cat()?>">
                        <i class="icon_phone"></i>
                        <h3>Điện thoại di động</h3>
                     </a>
                     <ul class="sub_bar">
                     <?
                     $list_cat00 = db_array('SELECT cat_name,cat_alias FROM categories WHERE cat_type = "products" LIMIT 10');
                     foreach($list_cat00 as $cat) {
                        ?>
                        <li><a href="/dien-thoai-<?=$cat['cat_alias']?>/"><?=$cat['cat_name']?></a></li>
                        <?
                     }
                     ?>
                     </ul>
                  </li>
                  <li class="nav_tablet">
                     <a href="<?=url_tablet_cat()?>">
                        <i class="icon_tablet"></i>
                        <h3>Máy tính bảng</h3>
                     </a>
                  </li>
                  <li class="nav_accessories">
                     <a href="<?=url_accessories_cat()?>">
                        <i class="icon_accessories"></i>
                        <h3>Phụ kiện</h3>
                     </a>
                     <ul class="sub_bar">
                     <?
                     $list_cat01 = db_array('SELECT cat_name,cat_alias FROM categories WHERE cat_type = "accessories" LIMIT 15');
                     foreach($list_cat01 as $cat) {
                        ?>
                        <li><a href="/phu-kien-<?=$cat['cat_alias']?>/"><?=$cat['cat_name']?></a></li>
                        <?
                     }
                     ?>
                     </ul>
                  </li>
                  <li class="nav_services">
                     <a href="<?=url_services_cat()?>">
                        <i class="icon_services"></i>
                        <h3>Dịch vụ sửa chữa</h3>
                     </a>
                     <ul class="sub_bar">
                     <?
                     $list_cat02 = db_array('SELECT * FROM categories WHERE cat_type = "services" AND cat_parent_id = 0 ORDER BY cat_order');
                     foreach($list_cat02 as $cat) {
                        ?>
                        <li><a href="<?=url_services_cat($cat['cat_alias'])?>"><?=$cat['cat_name']?></a></li>
                        <?
                     }
                     ?>
                     </ul>
                     <style>
                     .home_nav > ul > li {
                        position: relative;
                     }
                     .sub_bar {
                        position: absolute;
                        top: 50px;
                        right: -12px;
                        z-index:  10001;
                        display: none;
                        border: 1px solid #ccc;
                        border-top: none;
                     }
                     .sub_bar li {
                        display: block !important;
                     }
                     .sub_bar li a {
                        background: #fff !important;
                        height: 30px !important;
                        line-height: 30px !important;
                        padding-left: 10px;
                        color: #333 !important;
                        margin-left: 0px !important;
                        text-shadow: 1px 1px #fff !important;
                     }
                     .nav_phone a:hover {
                        background: #0096dc !important;
                     }
                     .nav_tablet a:hover {
                        background: #f28300 !important;
                     }
                     .nav_accessories a:hover {
                        background: #78af00 !important;
                     }
                     .nav_services a:hover {
                        background: #bf0636 !important;
                     }
                     .nav_phone:hover .sub_bar {
                        display: block;
                     }
                     .nav_accessories:hover .sub_bar {
                        display: block;
                     }
                     .nav_services:hover .sub_bar {
                        display: block;
                     }
                     </style>
                  </li>
               </ul>
            </div>
            <div class="home_list">
            <?php
            $arr_os = array('android'=>'Android','ios'=>'IOS (iPhone)','windows'=>'Windows Phone','other'=>'HĐH khác');
            $home_products = $general->home_products();
            $list_instock_status = array(0=>'Hết hàng',1=>'Còn hàng',2=>'Sắp về',3=>'Sắp ra mắt');
            foreach($home_products as $product) {
               ?>
               <div class="proitem">
                  <?=$product['pro_promotion'] != '' ? '<span class="tagmotion">Khuyến mãi</span>' : ''?>
                  <a href="<?=url_product_detail($product)?>">
                     <img src="<?=img_link($product['pro_image'],'small')?>" alt="<?=$product['pro_name']?>" />
                     <p class="goods"><?=$list_instock_status[$product['pro_instock_status']]?></p>
                     <h3 class="name"><?=$product['pro_name']?></h3>
                     <h4 class="price"><?=format_price($product['pro_price'])?></h4>
                     <?=$product['pro_promotion'] != '' ? '<p class="motion">Khuyến mãi lớn</p>' : ''?>
                     <div class="info">
                        <span>Màn hình: <?=$product['pro_display_standard']?>, <?=$product['pro_display_width']?> inches</span>
                        <span>HĐH: <?=$arr_os[$product['pro_general_os']]?></span>
                        <span>CPU: <?=$product['pro_cpuram_core']?>, <?=$product['pro_cpuram_speed']?>, RAM <?=$product['pro_cpuram_ram']?></span>
                        <span>Camera: <?=$product['pro_cam_primary']?>, <?=$product['pro_connect_duasim']?></span>
                        <span>Dung lượng pin: <?=$product['pro_pin_capacity']?></span>
                     </div>
                  </a>
               </div>
               <?
            }
            $home_accessories = $general->home_accessories();
            foreach($home_accessories as $product) {
               ?>
               <div class="proitem">
                  <?=$product['acc_promotion'] != '' ? '<span class="tagmotion">Khuyến mãi</span>' : ''?>
                  <a href="<?=url_accessories_detail($product)?>">
                     <img src="<?=img_link($product['acc_image'],'small')?>" alt="<?=$product['acc_name']?>" />
                     <p class="goods"><?=$list_instock_status[$product['acc_instock_status']]?></p>
                     <h2 class="name"><?=$product['acc_name']?></h2>
                     <h4 class="price"><?=format_price($product['acc_price'])?></h4>
                     <?=$product['acc_promotion'] != '' ? '<p class="motion">Khuyến mãi lớn</p>' : ''?>
                  </a>
               </div>
               <?
            }
            ?>
            </div>
         </div>
         <?php include ROOT.'/home/view/view_sidebar_home.php'?>
      </div>
   </div>
</div>